<template>
</template>
<script>

export default {
     async asyncData({params,$Data,error,redirect}) {
         var pid = params.pathMatch;
         let res = await $Data.getPost(pid);
         if(res.code>0){
            console.error("getATopic Error:",res.msg);
            return;
         }
         //console.log(params,"post:",res)
        let post = res.data;
        if(!post || !post.pid){
            error({
                'statusCode':404,
                'message':'Page Not Found',
            })
            return
        }
        res = await $Data.getTopic(post.tid);
        redirect("301","/topic/"+res.data.slug);
 
         
     }
}
</script>